package hotgammon.domain;

public class StrategyMoveAlphamon implements StrategyMove{

	public boolean move(Board board, Game game, Location from, Location to, Boolean validate) {
		//Can't move if it is not your turn
		if(!game.getColor(from).equals(game.getPlayerInTurn())){
			return false;
		}
		//Can't move to a place with more than 1 opposite checker
		//Edit001: No checker can be moved to a place with another color
		else if(game.getCount(to)>=0 && !game.getColor(from).equals(game.getColor(to)) && !game.getColor(to).equals(Color.NONE) ){
			return false;
		}
		//Bar movement
		//Edit005: Deleted...
		
		//Edit004: Added fix for bear off movement which was handled by direction move
		else if(game.getColor(from).equals(Color.BLACK) && to.equals(Location.R_BEAR_OFF)){
			return false;
		}
		//Correct direction movement
		//Edit002: Deleted...
		
		//Legal move
		if(!validate)board.move(from, to);
		//game.nextTurn();
		return true;
	}

}
